-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools/gcc-frr-format: fix ICE in gcc-10 #7443
tools/gcc-frr-format: fix ICE in gcc-10 #7443
Conversation
gcc-10 has a more strict internal assert for type checks so the plugin currently causes an Internal Compiler Error. Fix. Signed-off-by: David Lamparter <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution to FRR!
Click for style suggestions
To apply these suggestions:
curl -s https://gist.githubusercontent.com/polychaeta/cd50d31d43bf40af8b42ce32d75080b4/raw/521467ddf12d20175fd7c7e3230984fae124772f/cr_7443_1604361969.diff | git apply
diff --git a/tools/gcc-plugins/frr-format.c b/tools/gcc-plugins/frr-format.c
index 6d91d2cdc..881d81797 100644
--- a/tools/gcc-plugins/frr-format.c
+++ b/tools/gcc-plugins/frr-format.c
@@ -2730,13 +2730,12 @@ tree type_normalize (tree type, tree *cousin, tree target = NULL)
}
/* gcc-10 asserts when you give a TYPE_DECL instead of the actual TYPE */
-static tree
-decl_deref(tree typ)
+static tree decl_deref(tree typ)
{
- while (TREE_CODE (typ) == TYPE_DECL)
- typ = DECL_ORIGINAL_TYPE (typ);
+ while (TREE_CODE(typ) == TYPE_DECL)
+ typ = DECL_ORIGINAL_TYPE(typ);
- return typ;
+ return typ;
}
static void
@@ -2885,7 +2884,8 @@ check_format_types (const substring_loc &fmt_loc,
|| cur_type == signed_char_type_node
|| cur_type == unsigned_char_type_node);
- int compat = lang_hooks.types_compatible_p (decl_deref (wanted_type), decl_deref (cur_type));
+ int compat = lang_hooks.types_compatible_p(decl_deref(wanted_type),
+ decl_deref(cur_type));
/* Check the type of the "real" argument, if there's a type we want. */
if ((TREE_CODE (wanted_type) != INTEGER_TYPE || types->pointer_count)
&& compat)
@@ -3192,8 +3192,8 @@ matching_type_p (tree spec_type, tree arg_type)
gcc_assert (spec_type);
gcc_assert (arg_type);
- spec_type = decl_deref (spec_type);
- arg_type = decl_deref (arg_type);
+ spec_type = decl_deref(spec_type);
+ arg_type = decl_deref(arg_type);
/* If any of the types requires structural equality, we can't compare
their canonical types. */
If you are a new contributor to FRR, please see our contributing guidelines.
After making changes, you do not need to create a new PR. You should perform an amend or interactive rebase followed by a force push.
polychaeta style comments are irrelevant, the gcc plugin follows GCC coding style. |
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-15137/ This is a comment from an automated CI system. Warnings Generated during build:Checkout code: Successful with additional warnings
Warnings Generated during build:Debian 10 amd64 build: Successful with additional warningsDebian Package lintian failed for Debian 10 amd64 build:
|
I'm not getting an ICE with gcc-10, at least not with normal 10.2.0. Do I actually have to build from source in order to even see the problem? |
The plugin is not used by default, cf. docs in https://github.com/FRRouting/frr/blob/master/tools/gcc-plugins/README.md |
umm, I meant "if I use the plugin and compile the test source file, I don't get an internal error" with gcc-9 or -10. |
Oh, sorry, I misunderstood. The ICE is triggered by the fine distinction between [Add.: that it ICEs in FRR build is also what made me jump to "you need to enable the plugin"] |
gcc-10 has a more strict internal assert for type checks so the plugin
currently causes an Internal Compiler Error. Fix.
The plugin works with
gcc-9
andgcc-10
after this fix. The single line patch to gcc is still needed, cf. docs.